#include <stdio.h>
#include <sys/type.h>
#include <unistd.h>

int main() {
    pid_t pid = fork();
    if (pid < 0) {
        return 1;
    }
    else if (pid == 0) {
        printf("子进程：父进程%d创建了子进程%d\n",
        getppid(), getpid());
    }
    else {
        printf("父进程：父进程%d创建了子进程%d\n",
        getpid(), pid);
    }
}